package com.cloudea.lotus.lambda;

import com.cloudea.lotus.Request;
import com.cloudea.lotus.Response;

import java.util.LinkedList;
import java.util.Map;

public class LotusLambdaExample extends LotusLambda {

    @Override
    public Response get(Request request) {
        return print(request);
    }

    @Override
        public Response post(Request request) {
        return print(request);
    }

    @Override
        public Response put(Request request) {
        return print(request);
    }

    @Override
        public Response delete(Request request) {
        return print(request);
    }

    public Response print(Request request){
        Map<String, String> args = request.getParameters();
        LinkedList<String> list = new LinkedList<>();
        for(String key : args.keySet()){
            list.add(key + "=" + args.get(key));
        }
        return Response.success(list);
    }
}
